Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Refactor some tests to use ArrayValidationNode #186

Conversation

arcondello
Copy link
Member

Replace uses of verify_array_diff with ArrayValidationNode.

@arcondello arcondello added the enhancement New feature or request label Dec 12, 2024
@arcondello arcondello requested a review from wbernoudy December 12, 2024 23:01
@arcondello arcondello marked this pull request as ready for review December 13, 2024 16:17
@arcondello arcondello changed the title Refactor some tests to use ArrayValidatioNode Refactor some tests to use ArrayValidationNode Dec 13, 2024
@@ -120,8 +121,6 @@ TEST_CASE("AdvancedIndexingNode") {
CHECK(B_ptr->size(state) == s_ptr->size(state));

CHECK(std::ranges::equal(B_ptr->view(state), std::vector{4}));

verify_array_diff({}, {4}, B_ptr->diff(state));
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Don't we need to call propagate on the ArrayValidationNode to ensure the diff is valid? Maybe we can switch a lot of these tests to using graph->propagate() so we don't have to propagate all the nodes individually...

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh! Good catch. Will fix everywhere.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok, should be fixed. Also made the tests a bit more future proof by just propagating/commiting/reverting all descendants.

@arcondello arcondello force-pushed the feature/use-ArrayValidationNode-more branch from 13534ef to 3b310b8 Compare January 6, 2025 20:21
@@ -463,6 +450,8 @@ TEST_CASE("SetNode") {

auto ptr = graph.emplace_node<SetNode>(num_elements);

graph.emplace_node<ArrayValidationNode>(ptr);
Copy link
Member

@wbernoudy wbernoudy Jan 6, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think you're still missing propagate and revert for this one

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good catch. Ok, this time I think I got them all.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ah, still an error. One sec.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ok, fixed. This time for real.

@arcondello arcondello force-pushed the feature/use-ArrayValidationNode-more branch 2 times, most recently from 521da7b to fa7bd8f Compare January 6, 2025 20:58
@arcondello arcondello merged commit 920b391 into dwavesystems:main Jan 6, 2025
35 checks passed
@arcondello arcondello deleted the feature/use-ArrayValidationNode-more branch January 6, 2025 22:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants